API Documentation
Public Member Functions | List of all members
nkGraphics::Entity Class Referencefinal

An entity in a render queue. It drives the shader and possible graph position for a set of renderables (SubEntity). More...

Inheritance diagram for nkGraphics::Entity:
nkExport::Exportable

Public Member Functions

NodegetParentNode () const
 
ShadergetShader () const
 
ShadergetRaytracingShader () const
 
RenderQueuegetRenderQueue () const
 
void setParentNode (Node *parent)
 
void setShader (Shader *shade)
 
void setRaytracingShader (Shader *shade)
 
bool isCompatibleWith (Shader *shade) const
 
void updateBasicShader ()
 
MeshgetMesh (int index) const
 
void meshLayoutUpdated (SubEntity *subEnt)
 
SubEntityaddChild ()
 
SubEntitygetChild (unsigned int index) const
 
int getChildCount ()
 
const std::vector< SubEntity * > & getChildren () const
 
void removeChild (unsigned int index)
 
void updateMeshBinding (SubEntity *caller, Mesh *oldMesh)
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable ()
 
virtual ~Exportable ()
 

Detailed Description

An entity in a render queue. It drives the shader and possible graph position for a set of renderables (SubEntity).

It is possible to create one by calling RenderQueue::addEntity().
Adding it to a graph can be done by setting its parent node through setParentNode().

Member Function Documentation

◆ getParentNode()

Node* nkGraphics::Entity::getParentNode ( ) const
Returns
The parent node.

◆ getShader()

Shader* nkGraphics::Entity::getShader ( ) const
Returns
The shader used, when used in a RenderScenePass.

◆ getRaytracingShader()

Shader* nkGraphics::Entity::getRaytracingShader ( ) const
Returns
The raytracing shader used, when in a raytraced queue used in a RaytracingPass.

◆ getRenderQueue()

RenderQueue* nkGraphics::Entity::getRenderQueue ( ) const
Returns
The parent render queue.

◆ setParentNode()

void nkGraphics::Entity::setParentNode ( Node parent)

Sets the parent node of the entity. This will impact the transformation applied to the entity when painting it. At all times, an entity can be attached to one node.

Parameters
parentThe node to get a transformation from.

◆ setShader()

void nkGraphics::Entity::setShader ( Shader shade)

Sets the shader to use during a RenderScenePass.

Parameters
shadeThe shader to use.

◆ setRaytracingShader()

void nkGraphics::Entity::setRaytracingShader ( Shader shade)

Sets the shader to use during a RaytracingPass.

Parameters
shadeThe shader to use.

◆ isCompatibleWith()

bool nkGraphics::Entity::isCompatibleWith ( Shader shade) const

Checks whether an entity is compatible with a shader. This takes into account the data available in renderables of the entity, and what the shader needs to be working.

Returns
Whether the entity will be compatible with a given shader.

◆ updateBasicShader()

void nkGraphics::Entity::updateBasicShader ( )

Updates the basic (built-in) shader attached to the entity. Used internally when adding new renderables to ensure a compatible shader is attached.

◆ getMesh()

Mesh* nkGraphics::Entity::getMesh ( int  index) const

Shortcut to get a mesh from renderables inside.

Parameters
indexThe index of the renderable to retrieve the mesh from.
Returns
The mesh requested from the renderable.

◆ meshLayoutUpdated()

void nkGraphics::Entity::meshLayoutUpdated ( SubEntity subEnt)

Called whenever an attached mesh has its layout updated through loading, or attachment to a sub-entity. This triggers some updates regarding the shaders used to ensure compatibilities. Used Internally.

Parameters
subEntThe event causing sub-entity.

◆ addChild()

SubEntity* nkGraphics::Entity::addChild ( )
Returns
A newly created sub entity. The entity is responsible for the memory returned, external code should not free it. See removeChild().

◆ getChild()

SubEntity* nkGraphics::Entity::getChild ( unsigned int  index) const
Parameters
indexThe index of the sub entity to retrieve.
Returns
The child requested if available, nullptr else.

◆ getChildCount()

int nkGraphics::Entity::getChildCount ( )
Returns
The number of children sub entities available.

◆ getChildren()

const std::vector<SubEntity*>& nkGraphics::Entity::getChildren ( ) const
Returns
The array of sub entities available in the entity.

◆ removeChild()

void nkGraphics::Entity::removeChild ( unsigned int  index)

Removes and frees the memory attached to a sub entity.

Parameters
indexThe index of the sub entity to remove.

◆ updateMeshBinding()

void nkGraphics::Entity::updateMeshBinding ( SubEntity caller,
Mesh oldMesh 
)

Updates the mesh bindings for a renderable sub entity. Used internally.

Parameters
callerThe calling sub entity.
oldMeshThe old mesh that was set before.

◆ exportClassToTree()

virtual void nkGraphics::Entity::exportClassToTree ( nkExport::Node rootNode)
overridevirtual

Basic exporting capabilities.

Parameters
rootNodeThe tree to export to.

Implements nkExport::Exportable.

◆ importClassFromTree()

virtual void nkGraphics::Entity::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

Basic importing capabilities.

Parameters
rootNodeThe tree to import from.

Implements nkExport::Exportable.


The documentation for this class was generated from the following file: